<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\modules\system\models\MenuCategory;
use common\helpers\Constants;

/* @var $this yii\web\View */
/* @var $searchModel common\modules\system\models\search\MenuCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$category = getGetValue('category');
$categoryModel = MenuCategory::findOne(['id'=>$category]);

$this->title = $categoryModel['name'];
$this->params['breadcrumbs'][] = [
    'label' => '菜单管理',
    'url' => ['/menu']
];
$this->params['breadcrumbs'][] = [
    'label' => $categoryModel['name'],
    'url' => ['/menu/menu/index','category'=>$category]
];
$this->params['breadcrumbs'][] = $this->title;

?>

<p>
    <?= Html::a('返回', ['/system/menu-category'], ['class' => 'btn btn-primary'])?>
    <?= Html::a('新建', ['create','category'=>$category], ['class' => 'btn btn-primary'])?>
</p>
   
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'columns' => [
            [
                'class' => 'common\grid\IdColumn'
            ],            
			[
				'class' => 'common\grid\DataColumn',
				'attribute' => 'name',
				'width' => '50px',
				'format' => 'html',
				'value' => function ($model,$key,$index,$column){
					return str_repeat(Constants::TAB_SIZE, $model->level).Html::a($model->name,['/system/menu/update','id'=>$model->id]);
				}
			], 
			[
			    'class' => 'common\grid\DataColumn',
			    'attribute' => 'url',
			    'width' => '100px'
			],
			[
			    'class' => 'common\grid\DataColumn',
			    'attribute' =>'targetText',
			    'width' => '50px'
			],
            [
                'class' => 'common\grid\DataColumn',
                'class'=>'common\grid\SortColumn',
            ],
            [
                'class' => 'common\grid\DataColumn',
                'class'=>'common\grid\StatusColumn',
            ],
          
            [
                'class' => 'common\grid\ActionColumn',
				'queryParams'=>['view'=>['category'=>$category]]
			],
        ],
    ]); ?>

                 
